package com.corpgovernment.organization.mapper.budget;

import com.corpgovernment.organization.entity.db.budget.BudgetGroupEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Set;

@Mapper
public interface BudgetGroupMapper  {

	int insertBatchSelective(@Param("entities") List<BudgetGroupEntity> entities);

	int updateBatchSelective(@Param("entities") List<BudgetGroupEntity> entities);

	List<BudgetGroupEntity> selectByBudgetId(@Param("budgetId") String budgetId);

	List<BudgetGroupEntity> selectByBudgetIds(@Param("budgetIds") List<String> budgetIds);

	List<BudgetGroupEntity> selectByCorpIdAndOrgName(@Param("corpId") String corpId, @Param("orgName") String orgName, @Param("scopeType") String scopeType);

	Set<String> selectOrgIdsByCorpId(@Param("corpId") String corpId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

	List<String> selectBudgetIdByCorpIdAndOrgIdAndTime(@Param("corpId") String corpId, @Param("orgIds") List<String> orgIds, @Param("timeFrom") Date timeFrom, @Param("timeTo") Date timeTo, @Param("scopeType") String scopeType);

	int existsByCorpIdAndOrgIdAndTime(@Param("corpId") String corpId, @Param("orgIds") List<String> orgIds, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

	List<String> matchApplyTripByStartTime(@Param("corpId") String corpId, @Param("orgId") String orgId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}